
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>填写合作信息</title>
		<meta http-equiv="Content-type" content="textml; charset=utf-8" />
		<meta content="telephone=no" name="format-detection" />
		<meta name="x5-orientation" content="portrait">
		<meta name="screen-orientation" content="portrait">
		<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=yes">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<link rel="icon" href="data:;base64,=">
		<link rel="stylesheet" type="text/css" href="//img.ejiayou.com/activity/pages/ejiayoupay/ejiayou/css/reset.css" />
		<link rel="stylesheet" href="css/index.css" />
		<link rel="stylesheet" type="text/css" href="css/index_style.css" />
		<style type="text/css">
			.new-cell {
				background: #fff;
			}
			
			.van-cell__title {
				width: 98px!important;
			}
			
			.van-cell__value {
				color: #323233;
				text-align: left;
			}
		</style>
	</head>

	<body>
		<div id="app" v-cloak>
			<van-cell value="结算基本信息"></van-cell>
			<div class="main_active">
				<van-form label-width="7em">
					<van-field v-model="accountName" label="油站对公账户名" placeholder="账户户名" label-width="7em"></van-field>
					<van-field v-model="bankBranch" label="油站账户支行" placeholder="开户支行名称" label-width="7em"></van-field>
					<van-field v-model="bankAccount" label="银行账户"></van-field>
					<van-field name="radio" label="账户类型">
						<template #input>
							<van-radio-group v-model="accountType" direction="horizontal">
								<van-radio name="1">企业户
									<template #icon="props">
										<img class="img-icon" :src="props.checked ? activeIcon : inactiveIcon" />
									</template>
								</van-radio>
								<van-radio name="0">个人户
									<template #icon="props">
										<img class="img-icon" :src="props.checked ? activeIcon : inactiveIcon" />
									</template>
								</van-radio>
							</van-radio-group>
						</template>
					</van-field>
					<van-field v-model="bankName" label="银行名称"></van-field>
					<van-field v-model="provinceName" readonly label="开户省份" right-icon="arrow" @click="showProvincePicker = true"></van-field>
					<van-field v-model="accountCityName" readonly label="开户城市" right-icon="arrow" @click="onShowCityPicker"></van-field>
					<van-cell value="油站证件信息"></van-cell>
					<van-field name="" label="营业执照">
						<template #input>
							<van-uploader v-model="businesslicensePics" multiple :max-count="1" :after-read="afterBusinessPic">

							</van-uploader>
						</template>
					</van-field>
					<van-field name="" class="van_field_long_length" label="开户许可证">
						<template #input>
							<van-uploader v-model="startbusinesslicensePics" multiple :max-count="1" :after-read="afterStartBusinessPic" />
						</template>
					</van-field>
					<van-field name="" class="van_field_long_length" label="法人身份证正面">
						<template #input>
							<van-uploader v-model="legalFrontPics" :after-read="afterLegalFrontPic" multiple :max-count="1" />
						</template>
					</van-field>
					<van-field name="" class="van_field_long_length" label="法人身份证反面">
						<template #input>
							<van-uploader v-model="legalReversePics" :after-read="afterLegalReversePic" multiple :max-count="1" />
						</template>
					</van-field>
					<van-field name="" class="van_field_long_length" label="油品经营危化证">
						<template #input>
							<van-uploader v-model="DangerousPics" :after-read="afterDangerousPic" multiple :max-count="1" />
						</template>
					</van-field>
					<van-cell value="合作信息"></van-cell>
					<van-field name="" class="van_field_long_length" label="合同照片">
						<template #input>
							<van-uploader v-model="contractPics" :after-read="afterContractPic" multiple :max-count="1" />
						</template>
					</van-field>
					<div class="submit_box_step">
						<van-button square type="primary" native-type="button" @click="rebackUrl">返回</van-button>
						<van-button square type="primary" native-type="submit" @click="saveComeToNext">确认申请</van-button>
					</div>
				</van-form>
			</div>

			<div class="overlayMask" v-if="overlayShow" @touchmove.stop.prevent>
				<div class="wrapper">
					<div class="wrapper_info">
						<div class="wrapper_title">{{wrapperTitle}}</div>
						<div class="wrapper_yijian">审批意见：</div>
						<div class="wrapper_textarea">
							<textarea v-model="mytext" name="" placeholder="非必填" id="" cols="30" rows="10">{{mytext}}</textarea>
						</div>
						<div class="wrapper_between">
							<div class="wrapper_between_fl" @click="overlayShow=false">取消</div>
							<div class="wrapper_between_rg" @click="submitApproval">确认</div>
						</div>
					</div>
				</div>
			</div>

			<div class="overlayMask" v-if="nonstandardShow" @touchmove.stop.prevent>
				<div class="wrapper" @touchmove>
					<div class="wrapper_info">
						<div class="wrapper_title">非标准上线流程</div>
						<div class="wrapper_sub_title" v-if="standard_data.work_type == 3">您提交的申请为非标准上线流程，需要审核通过后，运营手动配置上线。预计上线时长5-10天。触发的非标规则如下：</div>
						<div class="wrapper_sub_title" v-if="standard_data.work_type == 2">您提交的申请为非标准上线流程，需要审核通过才能上线，预计上线时长3-5天。触发的非标规则如下：</div>
						<div class="wrapper_content">
							<div>
								<p v-for="(remark, remark_index) in standard_data.remark">
									{{remark_index+1}}.{{remark}}
								</p>
							</div>
						</div>
						<div class="wrapper_between">
							<div class="wrapper_between_fl" @click="nonstandardShow=false">取消</div>
							<div class="wrapper_between_rg" @click="applySure">确认申请</div>
						</div>
					</div>
				</div>
			</div>
			<van-popup v-model="showProvincePicker" round position="bottom">
				<van-picker show-toolbar :columns="provinceList" value-key="provinceName" @cancel="showProvincePicker = false" @confirm="provincePickerConfirm"></van-picker>
			</van-popup>
			<van-popup v-model="showCityPicker" round position="bottom">
				<van-picker show-toolbar :columns="cityList" value-key="cityName" @cancel="showCityPicker = false" @confirm="cityPickerConfirm"></van-picker>
			</van-popup>
		</div>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://img.ejiayou.com/activity/js/common/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vant.min.js"></script>
		<script src="js/utils.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/area.js" type="text/javascript" charset="utf-8"></script>
		<script src="//cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
		<script src="js/upload.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			eval(function(p, a, c, k, e, r) {
				e = function(c) {
					return c.toString(a)
				};
				if(!''.replace(/^/, String)) {
					while(c--) r[e(c)] = k[c] || e(c);
					k = [function(e) {
						return r[e]
					}];
					e = function() {
						return '\\w+'
					};
					c = 1
				};
				while(c--)
					if(k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
				return p
			}('(6(a,d){j b=a.i,e="3"f 5?"3":"9",c=6(){b.7.8=(2>b.4?b.4:2)/2*g+"h"};a.0&&(d.0(e,c,!1),a.0("k",c,!1))})(l,5);',
				22, 22,
				'addEventListener||750|orientationchange|clientWidth|window|function|style|fontSize|resize||||||in|64|px|documentElement|var|DOMContentLoaded|document'
				.split('|'), 0, {}))
				
			var vConsole = null;
			if(getQueryVariable('debug') == "true"){
				vConsole = new VConsole();
			}
		</script>
		<script>
			var look_gd = getQueryVariable('look_gd') || ''
			var admin_id = getQueryVariable('admin_id') || ''
			var work_order_id = getQueryVariable('work_order_id') || ''
			var look_gd_text = getQueryVariable('look_gd_text') || ''
			var order_type_id = getQueryVariable('order_type_id') || 1
			var from_page = getQueryVariable('from_page') || ''
			var json_list = ''
			// 在 #app 标签下渲染一个按钮组件
			var vm = new Vue({
				el: '#app',
				data: {
					columns: ['杭州', '宁波', '温州', '绍兴', '湖州', '嘉兴', '金华', '衢州'],
					activityHost: (window.location.origin.indexOf("dev.ejiayou.com") != -1 ? window.location.origin : "//finance.ejiayou.com"),
					activeIcon: 'https://img.ejiayou.com/activity/jiguang_upload/img/active_icon.png',
					inactiveIcon: 'https://img.ejiayou.com/activity/jiguang_upload/img/inactive_icon.png',
					sales: '',
					isActivity: '0',
					businesslicensePic: '',
					businesslicensePics: [],
					startbusinesslicensePic: '',
					startbusinesslicensePics: [],
					legalFrontPics: [],
					legalFrontPic: '',
					legalReversePics: [],
					legalReversePic: '',
					DangerousPics: [],
					look_gd: look_gd,
					look_gd_text: look_gd_text,
					admin_id: admin_id,
					work_order_id: work_order_id,
					order_type_id: order_type_id,
					DangerousPic: '',
					bankBranch: '',
					bankAccount: '',
					bankName: '',
					accountType: '1',
					accountCityName: '',
					provinceName: '',
					accountName: '',
					stationId: '',
					publicAccount: '',
					nonstandardShow: false,
					standard_data: null,
					from_page: from_page,
					provinceList: [],
					cityList: [],
					showProvincePicker: false,
					showCityPicker: false,
					overlayShow: false,
					wrapperTitle: '',
					work_order_status: 1,
					mytext: "",
					contractPics:[],
					contractPic:'',
				},
				created: function() {

				},
				mounted: function() {
					var self = this
					this.getFormData(function() {
						self.sales = json_list.sales || ''
						self.isActivity = json_list.isActivity || '0'
						self.businesslicensePic = json_list.businesslicensePic || ''
						self.businesslicensePics = json_list.businesslicensePics || []
						self.startbusinesslicensePic = json_list.startbusinesslicensePic || ''
						self.startbusinesslicensePics = json_list.startbusinesslicensePics || []
						self.legalFrontPics = json_list.legalFrontPics || []
						self.legalFrontPic = json_list.legalFrontPic || ''
						self.legalReversePics = json_list.legalReversePics || []
						self.legalReversePic = json_list.legalReversePic || ''
						self.DangerousPics = json_list.DangerousPics || []
						self.DangerousPic = json_list.DangerousPic || ''
						self.contractPics = json_list.contractPics || []
						self.contractPic = json_list.contractPic || ''
						self.bankBranch = json_list.bankBranch || ''
						self.publicAccount = json_list.publicAccount || ''
						self.bankAccount = json_list.bankAccount || '',
						self.bankName = json_list.bankName || ''
						self.accountType = json_list.accountType || ''
						self.accountCityName = json_list.accountCityName || ''
						self.provinceName = json_list.provinceName || ''
						self.accountName = json_list.accountName || ''
						self.stationId = json_list.stationId || ''
					})
					this.loadProvince()
				},
				methods: {
					rebackUrl: function() {
						history.back()
					},
					applyPass: function() {
						this.wrapperTitle = '审批通过'
						this.work_order_status = 1
						this.overlayShow = true
					},
					rejectGd: function() {
						this.wrapperTitle = '审批驳回'
						this.work_order_status = 2
						this.overlayShow = true
					},
					onShowCityPicker() {
						if(this.provinceName) {
							this.showCityPicker = true
						} else {
							vant.Toast('请先选择开户省份')
						}
					},
					provincePickerConfirm(data) {
						if(data.showCityPicker !== this.provinceName) {
							this.accountCityName = ''
						}
						this.provinceName = data.provinceName
						this.loadCity(data.provinceId)
						this.showProvincePicker = false
					},
					cityPickerConfirm(data) {
						this.accountCityName = data.cityName
						this.showCityPicker = false
					},
					loadCity(provinceId) {
						$.ajax({
							url: '/station-platform/platform/settlementBankManagement/citys',
							type: 'get',
							dataType: 'json',
							data: {
								provinceId: provinceId
							},
							success: (res) => {
								if(res.code === 0) {
									this.cityList = res.data
								}
							}
						})
					},
					loadProvince() {
						$.ajax({
							url: '/station-platform/platform/settlementBankManagement/province',
							type: 'get',
							dataType: 'json',
							success: (res) => {
								if(res.code === 0) {
									this.provinceList = res.data
								}
							}
						})
					},
					submitApproval: function(fn) {
						var self = this
						var data = {

							work_order_id: this.work_order_id,
							admin_id: this.admin_id,
							remark: this.mytext,
							audit: this.work_order_status
						}
						$.ajax({
							url: '/eapi/v1/activity/work/exchange_node',
							data: data,

							type: 'post',
							dataType: 'json',
							success: function(res) {
								console.log(res)
								if(res.status == 200) {
									var resData = res.data
									location.replace('/pages/aurora_project/work_system/index.html?user_id=' + self.admin_id)
								}
							},
						})
					},
					rebackGd: function() {
						var self = this
						location.replace('/pages/aurora_project/work_system/index.html?user_id=' + self.admin_id)
					},
					applySure: function() {
						var self = this
						this.createFormSave(json_list, 1, function() {
							location.replace('/pages/aurora_project/work_system/index.html?user_id=' + self.admin_id)
						})
					},
					getFormData: function(fn) {
						var self = this
						var data = {
							admin_id: this.admin_id,
							work_order_id: this.work_order_id
						}
						$.ajax({
							url: '/eapi/v1/activity/work/info',
							data: data,
							type: 'get',
							dataType: 'json',
							success: function(res) {
								console.log(res)
								if(res.status == 200) {
									var resData = res.data
									self.title = resData.title
									json_list = JSON.parse(resData.content)
									if(fn) {
										fn()
									}
								}
							}
						})

					},
					createFormSave: function(json_list_data, is_exchange, fn) {
						var self = this
						var data = {
							order_type_id: 5,
							title: self.title,
							content: JSON.stringify(json_list_data),
							admin_id: this.admin_id,
							work_order_id: this.work_order_id,
							is_exchange: is_exchange
						}
						$.ajax({
							url: '/eapi/v1/activity/work/form_save',
							data: data,
							type: 'post',
							dataType: 'json',
							success: function(res) {
								console.log(res)
								if(res.status == 200) {
									var resData = res.data
									localStorage.removeItem('ejy_work_order_id')
									fn()
								} else {
									console.log(res)
								}
							},
							error: function(err) {
								vant.Toast(err.responseJSON.error.message)
							}
						})
					},
					comeToBack: function() {
						if(look_gd == 1) {
							location.replace(decodeURIComponent(getQueryVariable('reback_url')))
						} else {
							json_list.sales = this.sales
							json_list.isActivity = this.isActivity
							json_list.businesslicensePic = this.businesslicensePic
							json_list.businesslicensePics = this.businesslicensePics
							json_list.startbusinesslicensePic = this.startbusinesslicensePic
							json_list.startbusinesslicensePics = this.startbusinesslicensePics
							json_list.legalFrontPics = this.legalFrontPics
							json_list.legalFrontPic = this.legalFrontPic
							json_list.legalReversePics = this.legalReversePics
							json_list.legalReversePic = this.legalReversePic
							json_list.DangerousPics = this.DangerousPics
							json_list.DangerousPic = this.DangerousPic
							this.createFormSave(json_list, function() {
								location.replace(decodeURIComponent(getQueryVariable('reback_url')))
							})
						}
					},
					// 判断是否是非标准流程
					judgeStandard: function(fn) {
						var self = this

						$.ajax({
							url: this.activityHost + '/cwxt/onlineStation/checkWorkType?return_value=2,3,4&work_order_id=' + this.work_order_id,

							type: 'get',
							success: function(res) {
								if(res.success == true) {
									fn(res.data)
								}
							},
						})
					},
					afterBusinessPic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							self.uploadTheIMG('afterBusinessPic', codes)
						})
					},
					afterStartBusinessPic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							self.uploadTheIMG('afterStartBusinessPic', codes)
						})
					},
					afterLegalFrontPic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							self.uploadTheIMG('afterLegalFrontPic', codes)
						})
					},
					afterLegalReversePic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							self.uploadTheIMG('afterLegalReversePic', codes)
						})
					},
					afterDangerousPic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							console.log(codes)
							self.uploadTheIMG('afterDangerousPic', codes)
						})
					},
					afterContractPic: function(file) {
						// 此时可以自行将文件上传至服务器
						var self = this
						UpladFile(file.file, function(codes) {
							console.log(codes)
							self.uploadTheIMG('afterContractPic', codes)
						})
					},
					uploadTheIMG: function(canshu, file) {
						var self = this
						$.ajax({
							type: 'POST',
							url: "/wxmp/view/uploadPic.ac",
							data: {
								imgData: file
							},
							// dataType: JSON,
							success: function(data) {
								var data = JSON.parse(data)
								if(canshu == 'afterBusinessPic') {
									for(var n = 0; n < self.businesslicensePics.length; n++) {

										self.$set(self.businesslicensePics[n], 'isImage', true)
										self.$set(self.businesslicensePics[n], 'content', data.data)
									}
									self.businesslicensePic = data.data
								}
								if(canshu == 'afterStartBusinessPic') {
									for(var n = 0; n < self.startbusinesslicensePics.length; n++) {
										self.$set(self.startbusinesslicensePics[n], 'isImage', true)
										self.$set(self.startbusinesslicensePics[n], 'content', data.data)
									}
									self.startbusinesslicensePic = data.data
								}
								if(canshu == 'afterLegalFrontPic') {
									for(var n = 0; n < self.legalFrontPics.length; n++) {
										self.$set(self.legalFrontPics[n], 'isImage', true)
										self.$set(self.legalFrontPics[n], 'content', data.data)
									}
									self.legalFrontPic = data.data
								}
								if(canshu == 'afterLegalReversePic') {
									for(var n = 0; n < self.legalReversePics.length; n++) {
										self.$set(self.legalReversePics[n], 'isImage', true)
										self.$set(self.legalReversePics[n], 'content', data.data)
									}
									self.legalReversePic = data.data
								}
								if(canshu == 'afterDangerousPic') {
									for(var n = 0; n < self.DangerousPics.length; n++) {
										self.$set(self.DangerousPics[n], 'isImage', true)
										self.$set(self.DangerousPics[n], 'content', data.data)
									}
									self.DangerousPic = data.data
								}
								if(canshu == 'afterContractPic') {
									for(var n = 0; n < self.contractPics.length; n++) {
										self.$set(self.contractPics[n], 'isImage', true)
										self.$set(self.contractPics[n], 'content', data.data)
									}
									self.contractPic = data.data
								}
							},

						});

					},
					rebackToLast: function() {
						location.replace(decodeURIComponent(getQueryVariable('reback_url')))
					},
					saveComeToNext: function() {
						var self = this
						json_list.publicAccount = this.publicAccount
						json_list.bankBranch = this.bankBranch
						json_list.bankAccount = this.bankAccount
						json_list.bankName = this.bankName
						json_list.accountType = this.accountType
						json_list.accountCityName = this.accountCityName
						json_list.provinceName = this.provinceName
						json_list.accountName = this.accountName
						json_list.stationId = this.stationId
						json_list.sales = this.sales
						json_list.isActivity = this.isActivity
						json_list.businesslicensePic = this.businesslicensePic
						json_list.businesslicensePics = this.businesslicensePics
						json_list.startbusinesslicensePic = this.startbusinesslicensePic
						json_list.startbusinesslicensePics = this.startbusinesslicensePics
						json_list.legalFrontPics = this.legalFrontPics
						json_list.legalFrontPic = this.legalFrontPic
						json_list.legalReversePics = this.legalReversePics
						json_list.legalReversePic = this.legalReversePic
						json_list.DangerousPics = this.DangerousPics
						json_list.DangerousPic = this.DangerousPic
						json_list.contractPics = this.contractPics
						json_list.contractPic = this.contractPic
						if(self.accountName == ''){
							vant.Toast('请填写油站对公账户名')
							return
						}else if(self.bankBranch == ''){
							vant.Toast('请填写油站账户支行')
							return
						}else if(self.bankAccount == ''){
							vant.Toast('请填写银行账户')
							return
						}else if(self.accountType == ''){
							vant.Toast('请选择账户类型')
							return
						}else if(self.bankName == ''){
							vant.Toast('请填写银行名称')
							return
						}else if(self.provinceName == ''){
							vant.Toast('请填写开户省份')
							return
						}else if(self.accountCityName == ''){
							vant.Toast('请填写开户城市')
							return
						}else if(self.businesslicensePics == ''){
							vant.Toast('请上传营业执照')
							return
						}else if(self.startbusinesslicensePics == ''){
							vant.Toast('请上传开户许可证')
							return
						}else if(self.legalFrontPics == ''){
							vant.Toast('请上传法人身份证正面')
							return
						}else if(self.legalReversePics == ''){
							vant.Toast('请上传法人身份证反面')
							return
						}else if(self.DangerousPics == ''){
							vant.Toast('请上传油品经营危化证')
							return
						}else if(self.contractPics == ''){
							vant.Toast('请上传合同照片')
							return
						}
						console.log(11, json_list)
						vant.Toast.loading({ message: '', forbidClick: true, duration: 0 });
						$.ajax({
							url: '/eapi/v1/activity/work/form_save',
							data:{
								order_type_id: 5,
								title: self.title,
								content: JSON.stringify(json_list),
								admin_id: self.admin_id,
								child_id: self.work_order_id,
								is_exchange: 1
							},
							type: 'post',
							dataType: 'json',
							success: function(res) {
								vant.Toast.clear()
								if(res.status == 200) {
									vant.Toast('操作成功')
									localStorage.removeItem('ejy_work_order_id')
									setTimeout(function(){
										location.replace('/pages/aurora_project/work_system/index.html?user_id=' + self.admin_id)
									},1500)
								}
							},
							error: function(err) {
								vant.Toast.clear()
								vant.Toast(err.responseJSON.error.message)
							}
						})
					}

				}
			});
			Vue.use(vant.Lazyload);
		</script>
	</body>

</html>